<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        function loadscript(url, callback) {
            let script = document.createElement('script');
            script.src = url;
            document.head.appendChild(script);
            if (script.readyState) {
                script.onreadychangestate = function() {
                    if (script.readyState == 'complete' || script.readyState == 'onloaded') {
                        callback();
                    }
                }
            } else {
                script.onload = function() {
                    callback();
                }
            }
        }
        loadscript('./tool.js', function() {
            text();
        })
    </script>
</body>

</html>